import Vue from 'vue'
import "mint-ui/lib/style.css"
import router from './router/router'
import store from './store/store'
import axios from 'axios'
import 'lib-flexible'
import api from "./api/api"

//开启debug模式
Vue.config.debug = true
window.log = console.log
Vue.prototype.axios = axios
Vue.prototype.router = router
Vue.prototype.api = api
Vue.filter('filterTime', (time) => {
	if (time) {
		var oDate = new Date();
		oDate.setTime(time);

		var y = oDate.getFullYear();
		var m = oDate.getMonth() + 1;
		var d = oDate.getDate();

		var h = oDate.getHours();
		var mm = oDate.getMinutes();
		var s = oDate.getSeconds();
		return y + '-' + m + '-' + d + ' ' + h + ':' + mm + ':' + s;
	}
})
Vue.prototype.args = function() {
    var qs = (location.search.length > 0 ? location.search.substring(1) : ""),
		args = {},
		items = qs.length ? qs.split("&") : [],
		item = null,
		name = null,
		value = null,
		i = 0,
		len = items.length;
	for (i = 0; i < len; i++) {
		item = items[i].split("=");
		name = decodeURIComponent(item[0]);
		value = decodeURIComponent(item[1]);
		if (name.length) {
			args[name] = value;
		}
	}
	return args;
}

Vue.filter('date', function(input) {
	var oDate = new Date(input);
	return oDate.getFullYear() + '年' + ((oDate.getMonth() + 1) < 10 ? "0" + (oDate.getMonth() + 1) : (oDate.getMonth() + 1)) + '月' + (oDate.getDate() < 10 ? "0" + oDate.getDate() : oDate.getDate()) + '日 ';
});

let data = {
	el: '#app',
	router,
	store
}
new Vue(data).$mount('#app')